<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page language="java" import="java.util.*,javax.naming.*,java.sql.*,javax.sql.*" %>
<%@ page import="com.simple.util.common.*" %>
<%@ include file="../include/head.jspf"%>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<c:set var="rowNo" value="1"/>
<html>
<head>
<style>
body { background: #f5f5f5 ;}
</style>
<link rel="stylesheet" href="resource/css/jquery-ui.css" type="text/css"  />
<script type="text/javascript" src="resource/js/jquery-ui.js"></script>
<script type="text/javascript">
function addSelect(){
	if (checkRadioStat("radioEnterprise")==true){
		document.selectForm.action="passChannelAdd";
		document.selectForm.submit();		
	}else{
		alert("必须选择一项企业");
		return ;
	}
}
function goPageEnterprise(pageNoEnterprise) {
	document.goPageForm.pageNoEnterprise.value = pageNoEnterprise;
	document.goPageForm.submit();
}
function goPageChannel(pageNoChannel) {
	document.goPageForm.pageNoChannel.value = pageNoChannel;
	document.goPageForm.submit();
}
function editSelect(){
	if (checkRadioStat("radioChannel")==true){
		document.selectForm.action="passChannelEdit";
		document.selectForm.submit();		
	}else{
		alert("必须选择一项传输方式");
		return ;
	}
	
}
function delSelect(){
	if (checkRadioStat("radioChannel")==true){
		document.selectForm.action="passChanneldel";
		document.selectForm.submit();
	}else{
		alert("必须选择一项传输方式");
		return ;
	}
}
function setEcCode(fcEntcode){
	$("#fcEntcode").val(fcEntcode);
	document.selectForm.action="passChannel";
	document.selectForm.submit();
}
function setChannelId(fcEntcode,serviceCode){
	$("#fcEntcode").val(fcEntcode);
	$("#fcServicecode").val(serviceCode);
}
function dataQuery(){
	var fcEntcode=$("#ecCodeSelect").val();
	$("#fcEntcode").val(fcEntcode);
	document.selectForm.action="passChannel";
	document.selectForm.submit();
}
$(document).ready(function(){
	$("#ecCodeSelect").autocomplete({source:"services/dataxFlow/getEnterpriseCode?originateCop="+$(this).val()});

});
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

<div id="body-wrapper">
  <!-- Wrapper for the radial gradient background -->
  <div id="main-content">
  <form action="passChannel" id="selectForm" name="selectForm" method="post">
  <input type="hidden" name="pageNoEnterprise" value="<c:out value='${pageNoEnterprise}'/>" />
  <input type="hidden" name="pageNoChannel" value="<c:out value='${pageNoChannel}'/>" />
  <input type="hidden" id="fcEntcode" name="fcEntcode" value="<c:out value='${fcEntcode}'/>"/>
  <input type="hidden" id="fcServicecode" name="fcServicecode" value="<c:out value=''/>">
    <!-- Main Content Section with everything -->
    <!-- Page Head -->
    <div id="page-title"><h3>企业传输通道管理</h3></div>
    <div class="pgline"></div>
    <div class="notification querytj png_bg">
      <div>
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="13%" height="35" align="right">&nbsp;&nbsp;企业编号：</td>
            <td width="29%"><input type="text" name="ecCodeSelect" id="ecCodeSelect" class="input2" value="<c:out value='${ecCodeSelect}'/>" /></td>
            <td width="15%" align="right">企业名称：</td>
            <td width="29%"><input type="text" name="ecNameSelect" id="ecNameSelect" class="input2" value="<c:out value='${ecNameSelect}'/>" /></td>
            <td width="17%" ><div><a class="button" href="#" onclick="dataQuery()">查询</a></div></td>
          </tr>
          
        </table>
      </div>
    </div>
    
    
    <div class="content-box">
      <!-- Start Content Box -->
      <div class="content-box-header">
        <h3>企业查询列表</h3>
        <div class="clear"></div>
      </div>
      <!-- End .content-box-header -->
      <div class="content-box-content">
        <div class="tab-content default-tab">
          <table>
            <thead>
              <tr>
                <th>&nbsp;</th>                
              	<th>序号</th>
                <th>企业编号</th>
                <th>企业名称</th>
                <th>机构代码</th>
                <th>城市</th>
                <th>负责人</th>
                <th>负责人电话</th>
                <th>负责人邮箱</th>
              </tr>
            </thead>
            <tfoot>
              <tr>
                <td colspan="9">
                  <c:out value="${pageInfoEnterprise}" escapeXml="false"></c:out>
                  <!-- End .pagination -->
                  <div class="clear"></div></td>
              </tr>
            </tfoot>
            <tbody>
              <c:forEach var="vwDataxEnterpriseVO" items="${vwDataxEnterpriseVOList}">
              <tr>
                <td><input type="radio" name="radioEnterprise" value="radioEnterprise" style="border-width:0" onclick="setEcCode('<c:out value="${vwDataxEnterpriseVO.ecCode}"/>')" <c:out value="${fcEntcode==vwDataxEnterpriseVO.ecCode?'Checked':''}"/>/></td>
                <td><c:out value="${(pageNoEnterprise-1)*8+rowNo}" ></c:out></td>
                <td><c:out value="${vwDataxEnterpriseVO.ecCode}"></c:out></td>
                <td><c:out value="${vwDataxEnterpriseVO.ecName}"></c:out></td>
                <td><c:out value="${vwDataxEnterpriseVO.orgCode}"></c:out></td>
                <td><c:out value="${vwDataxEnterpriseVO.city}"></c:out></td>
                <td><c:out value="${vwDataxEnterpriseVO.name}"></c:out></td>
                <td><c:out value="${vwDataxEnterpriseVO.officePhone}"></c:out></td>
                <td><c:out value="${vwDataxEnterpriseVO.email}"></c:out></td>
              </tr>
              <c:set var="rowNo" value="${rowNo+1}"/>
              </c:forEach>
            </tbody>
          </table>
        </div>
        <!-- End #tab1 -->
      </div>
      <!-- End .content-box-content -->
    </div>
    
    <c:choose>
    	<c:when test="${dataxEnterpriseChannelVOListSize>-1}">
    	<div class="content-box">
      <!-- Start Content Box -->
      <div class="content-box-header">
        <h3>传输方式列表</h3>
        <div class="clear"></div>
      </div>
      <!-- End .content-box-header -->
      <div class="content-box-content">
        <div class="tab-content default-tab">
          <table>
            <thead>
              <tr>
              	<th>&nbsp;</th> 
                <th>企业编号</th>
                <th>服务编码</th>
                <th>发送通道编号</th>
                <th>发送传输方式</th>
                <th>发送物理地址</th>
                <th>接收通道编号</th>
                <th>接收传输方式</th>
                <th>接收物理地址</th>
                <th>状态</th>
              </tr>
            </thead>
            <tfoot>
              <tr>
                <td colspan="10">
                 <c:out value="${pageInfoChannel}" escapeXml="false"></c:out>
                  <!-- End .pagination -->
                  <div class="clear"></div></td>
              </tr>
            </tfoot>
            <tbody>
              <c:forEach var="dataxEnterpriseChannelVO" items="${dataxEnterpriseChannelVOList}">
              <tr>
              	<td><input type="radio" name="radioChannel" value="radioChannel" style="border-width:0" onclick="setChannelId('<c:out value="${dataxEnterpriseChannelVO[0]}"/>','<c:out value="${dataxEnterpriseChannelVO[1]}"/>')"/></td>
                <td><c:out value="${dataxEnterpriseChannelVO[0]}"></c:out></td>
                <td><c:out value="${optionServeTypeMap[dataxEnterpriseChannelVO[1]]}"></c:out></td>
                <td><c:out value="${dataxEnterpriseChannelVO[2]}"></c:out></td>
                <td><c:out value="${optionCommunTypeMap[fn:trim(dataxEnterpriseChannelVO[3])]}"></c:out></td>
                <td><c:out value="${dataxEnterpriseChannelVO[4]}"></c:out></td>
                <td><c:out value="${dataxEnterpriseChannelVO[5]}"></c:out></td>
                <td><c:out value="${optionCommunTypeMap[fn:trim(dataxEnterpriseChannelVO[6])]}"></c:out></td>
                <td><c:out value="${dataxEnterpriseChannelVO[7]}"></c:out></td>
                <td><c:out value="${optionFiFlag[fn:trim(dataxEnterpriseChannelVO[8])]}"></c:out></td>
              </tr>
              </c:forEach>
            </tbody>
          </table>
        </div>
        <!-- End #tab1 -->
      </div>
      <!-- End .content-box-content -->
    </div>
    
    <div class="clear"></div>
     <div class="bulk-actions align-left"> <a class="button2" href="javascript:void(0)" onclick="addSelect();">新建</a>&nbsp;&nbsp;</div>    
     <div class="bulk-actions align-left"> <a class="button2" href="javascript:void(0)" onclick="editSelect();">修改</a>&nbsp;&nbsp;</div>
    <div class="clear"></div>
    	</c:when>
    </c:choose>
    
	</form>
  </div>
  
    
  <!-- End #main-content -->
</div>
<form method="post" action="passChannel" id="goPageForm" name="goPageForm">
      <input type="hidden" name="pageNoEnterprise" value="<c:out value='${pageNoEnterprise}'/>" />
      <input type="hidden" name="pageNoChannel" value="<c:out value='${pageNoChannel}'/>" />
      <input type="hidden" id="ecCodeSelect" name="ecCodeSelect" value="<c:out value='${ecCodeSelect }' />">
      <input type="hidden" id="ecNameSelect" name="ecNameSelect" value="<c:out value='${ecNameSelect }' />">
</form>
</body> 
</html>